package com.summer.core.container;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import com.taobao.api.domain.User;
import com.taobao.api.domain.UserInfo;



/**
 * @author dlc
 * CreateTime 2007-12-20
 * TODO 
 */
public class SessionContainerUtil {

	public static SessionContainer getSessionContainer(HttpServletRequest request) {
    	HttpSession session = request.getSession();
    	SessionContainer container = (SessionContainer) session.getAttribute(Const.SessionContainer);
    	return container;
    }
	
	public static User getUser(HttpServletRequest request) {
        SessionContainer container = SessionContainerUtil.getSessionContainer(request);
        if(container == null)
	        return null;
        return container.getUser();
    }
	
	public static User getUser(HttpSession session) {
	    SessionContainer container = (SessionContainer) session.getAttribute(Const.SessionContainer);
	    if(container == null)
	        return null;
	    return container.getUser();
	}
}
